package com.zte.claa.inficombo.csa.app.service.rptparse.ext.gnss.mina.msgbean;

import java.util.concurrent.atomic.AtomicLong;

import com.zte.claa.inficombo.csa.app.service.rptparse.ext.RptRawData;

public class GnssRequest {
	// 请求序号
	private static AtomicLong REQSNO_SEED = new AtomicLong(1);
	// GNSS终端上报的原始码流.
	private RptRawData rawData;
	// 顺序号.
	private long reqNo = 0;
	
	public GnssRequest(){
		this.reqNo = REQSNO_SEED.getAndIncrement();
		if(this.reqNo > 999999999L){
			REQSNO_SEED.set(1);
		}
	}

	public RptRawData getRawData() {
		return rawData;
	}

	public void setRawData(RptRawData rawData) {
		this.rawData = rawData;
	}
	
	public int getPayLoadSize(){
		if(this.rawData == null || this.rawData.getPayload() == null){
			return 0;
		}
		return this.rawData.getPayload().length;
	}
	
	public long getReqNo(){
		return this.reqNo;
	}

	public String getDevEui(){
		return this.rawData.getDeveui();
	}
	
	public String getDevName(){
		return this.rawData.getDevName();
	}
	
	public String getAppEui(){
		return this.rawData.getAppeui();
	}
	
	public String getProjectId(){
		return this.rawData.getProjectid();
	}
	
	public String getDevType(){
		return this.rawData.getDevtype();
	}
	
	public String getPortStr(){
		return this.rawData.getPortStr();
	}
	
	public byte[] getPayLoad(){
		if(this.rawData == null){
			return new byte[0];
		}
		return this.rawData.getPayload();
	}
	
	public String toString(){
		return "["+this.reqNo+"]"+String.valueOf(this.rawData);
	}
}
